package com.efamily.ewallet.client.common;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.grid.SummaryType;

public class DifferentItemsSummaryRenderer extends SummaryType<Integer> {

	@SuppressWarnings("unchecked")
	@Override
	public Integer render(Object v, ModelData model, String field, Map data) {
		Set setOfValues = (Set) data.get(field + "count");
		if (setOfValues == null) {
			setOfValues = new HashSet();
			data.put(field + "count", setOfValues);
		}
		setOfValues.add(model.get(field));
		return setOfValues.size();
	}
}